package com.lsfb.signln.Leave.AddLeave;

import android.content.Context;

import com.facebook.drawee.view.SimpleDraweeView;
import com.lsfb.signln.R;
import com.lsfb.signln.Utils.URLString;
import com.zgscwjm.lsfbbasetemplate.adapter.CommonRecycAdapter;
import com.zgscwjm.lsfbbasetemplate.adapter.ViewHolderRecyc;

import java.util.List;

/**
 * Created by Administrator on 2018/2/10 0010.
 */

public class CopyToPersonAdapter extends CommonRecycAdapter<ApprovalPersonBean.ClistBean> {
    private Context mContext;

    public CopyToPersonAdapter(Context context, List<ApprovalPersonBean.ClistBean> list, int layoutId) {
        super(context, list, layoutId);
        mContext = context;
    }

    @Override
    public void convert(ViewHolderRecyc holder, ApprovalPersonBean.ClistBean model) {
        holder.setText(R.id.item_tv_name, model.getName());
        if (model.getHeadimg() != null && !model.getHeadimg().isEmpty()) {
            holder.setVisible(R.id.img_head, true);
            holder.setVisible(R.id.item_text_head, false);
            holder.setImg(R.id.img_head, URLString.IMAGES + model.getHeadimg(), R.mipmap.img_test_head_hui);
        } else {
            holder.setVisible(R.id.img_head, false);
            holder.setVisible(R.id.item_text_head, true);
            holder.setText(R.id.item_text_head, model.getName().substring(model.getName().length() - 2, model.getName().length()));
            SimpleDraweeView img_head = holder.getView(R.id.img_head);
            img_head.setBackgroundColor(mContext.getResources().getColor(R.color.theme_font2));
        }
    }
}
